package com.github.baichuan.mapping.entity;


import com.github.baichuan.mapping.Mapping;
import lombok.Getter;

import java.util.LinkedList;
import java.util.List;

@Getter
public class TreeNode {
    @Mapping
    private String id;

    @Mapping("parent.id")
    private String parentId;

    @Mapping
    private String name;

    @Mapping("iconCss")
    private String icon;

    @Mapping
    private String code;

    @Mapping
    private Resource.Kind kind;

    @Mapping
    private String route;

    @Mapping
    private String path;

    @Mapping
    private Integer sort;

    private List<TreeNode> children;

    public void appendChild(TreeNode child){
        if(children == null){
            children = new LinkedList<>();
        }
        children.add(child);
    }
}
